package schoolWork.work02;

public class CardDemo {
    public static void main(String[] args) {
        String s[] = {"黑桃", "红桃", "梅花", "方块"};
        String f[] = {"A", "2", "3", "4", "5", "6", "7", "8", "9",
                "10", "J", "Q", "K"};

        //给52张牌赋值
        Card[] deck = new Card[52];
        for (int i = 0; i < 4; i++) {
            // 创建花色数组
            for (int j = 0; j < 13; j++) {
                deck[i * 13 + j] = new Card(s[i], f[j]);
            }
        }

        //模拟洗牌的过程
        for (int i = 0; i < 52; i++) {
            int r = (int) (Math.random() * 52);
            Card temp = deck[r];
            deck[r] = deck[i];
            deck[i] = temp;
        }

        //打印52张牌
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 13; j++) {
                System.out.print(deck[13 * i + j] + " ");
            }
            System.out.println();
        }
    }
}
